PCA Analysis

We need to find all the samples for which there is 16s-assigned taxonomic names:

##   [1] "Aeromicrobium fastidiosum"       "Bacillus clausii"               
##   [3] "Paenibacillus sp."               "Paenibacillus sp."              
##   [5] "Arthrobacter gandavensis"        "Micrococcus luteus"             
##   [7] "Micrococcus sp."                 "Streptomyces sp."               
##   [9] "Oerskovia sp."                   "Bacillus sp."                   
##  [11] "Micrococcus luteus"              "Paenibacillus sp."              
##  [13] "Kocuria palustris"               "Micrococcus sp."                
##  [15] "Arthrobacter sp."                "Arthrobacter sp."               
##  [17] "Microbacterium sp."              "Microbacterium sp."             
##  [19] "Micrococcus sp."                 "Staphylococcus succinus"        
##  [21] " Bacillus licheniformis"         "Maribacter sp."                 
##  [23] "Psychrobacillus psychrodurans"   "Variovorax sp."                 
##  [25] "Streptomyces lavendulae"         " Pseudomonas sp."               
##  [27] "Mesorhizobium sp."               "Deefgea sp."                    
##  [29] "Deefgea sp."                     "Yersinia sp."                   
##  [31] "Arthrobacter sp."                "Marmoricola sp."                
##  [33] "Microbacterium deminutum"        "Microbacterium phyllosphaerae"  
##  [35] "Microbacterium phyllosphaerae"   "Thiomonas intermedia"           
##  [37] "Thiomonas sp."                   "Thiomonas intermedia"           
##  [39] "Thiomonas sp."                   "Thiomonas intermedia"           
##  [41] "Micrococcus sp."                 "Curvibacter sp."                
##  [43] "Bacillus simplex"                "Agrococcus sp."                 
##  [45] "Agrococcus sp."                  "Curvibacter sp."                
##  [47] "Dermacoccus sp."                 "Curvibacter sp"                 
##  [49] "Agrococcus sp."                  "Sporosarcina aquimarina"        
##  [51] "Staphylococcus cohnii"           "Arthrobacter equi"              
##  [53] "Sandaracinobacter sibiricus"     "Hydrogenophaga sp."             
##  [55] "Micromonospora sp."              "Bacillus simplex"               
##  [57] "Bacillus pumilus"                "Mycobacterium sp."              
##  [59] "Dyadobacter sp."                 "Paenibacillus pectinilyticus"   
##  [61] "Bacillus arbutinivorans"         "Bacillus sp."                   
##  [63] "Kytococcus sedentarius"          "Bacillus sp."                   
##  [65] "Paenibacillus sp."               "Bacillus subtilis"              
##  [67] "Bacilllus subtilis"              "Salinicoccus sp."               
##  [69] "Bacillus subtilis"               "Shewanella sp."                 
##  [71] "Bacillus sp."                    "Streptomyces paucisporeus"      
##  [73] "Bacillus simplex"                "Bacillus sp."                   
##  [75] "Cellulophaga sp."                "Salinococcus sp."               
##  [77] "Salinicoccus sp."                "Shewanella sp."                 
##  [79] "Shewanella sp."                  "Cellulophaga sp."               
##  [81] "Cellulophaga sp."                "Cellulophaga sp."               
##  [83] "Cellulophaga sp."                "Shewanella sp."                 
##  [85] "Shewanella sp."                  "Shewanella sp."                 
##  [87] "Micrococcus sp."                 "Salinicoccus sp."               
##  [89] "Shewanella sp."                  "Rhodococcus fascians"           
##  [91] "Nocardioides sp."                "Nocardioides glacieisoli"       
##  [93] "Nocardioides sp."                "Microbacterium deminutum"       
##  [95] "Shewanella sp."                  "Rhodococcus sp."                
##  [97] "Cellulophaga sp."                "Shewanella sp."                 
##  [99] "Shewanella sp."                  "Shewanella sp."                 
## [101] "Shewanella sp."                  "Cellulophaga sp."               
## [103] "Algoriphagus sp."                "Shewanella sp."                 
## [105] "Maribacter sp."                  "Aquimarina sp."                 
## [107] "Loktanella sp."                  "Aquimarina sp."                 
## [109] "Shewanella sp."                  "Shewanella sp."                 
## [111] "Shewanella sp."                  "Shewanella sp."                 
## [113] "Vibrio sp."                      "Rhizobium sp."                  
## [115] " Shewanella sp."                 "Serratia sp."                   
## [117] "Rhizobium sp."                   "Shewanella sp."                 
## [119] " Bacillus thuringiensis"         "Rhodococcus globerulus"         
## [121] "Bacillus sp."                    "Rathayibacter festucae"         
## [123] "Bacillus sp."                    "Shewanella sp."                 
## [125] "Bacillus licheniformis"          "Micrococcus luteus"             
## [127] "Bacillus psychrosaccharolyticus" "Paenibacillus ehimensis"        
## [129] " pSEUDOMONAS SP."                "Pseudomonas sp."                
## [131] "Pseudomonas fluorescens"         "Rhodococcus sp."                
## [133] "Micrococcus luteus"              "Pseudomonas mendocina"

Just return Genus

##   [1] "Aeromicrobium"     "Bacillus"          "Paenibacillus"    
##   [4] "Paenibacillus"     "Arthrobacter"      "Micrococcus"      
##   [7] "Micrococcus"       "Streptomyces"      "Oerskovia"        
##  [10] "Bacillus"          "Micrococcus"       "Paenibacillus"    
##  [13] "Kocuria"           "Micrococcus"       "Arthrobacter"     
##  [16] "Arthrobacter"      "Microbacterium"    "Microbacterium"   
##  [19] "Micrococcus"       "Staphylococcus"    ""                 
##  [22] "Maribacter"        "Psychrobacillus"   "Variovorax"       
##  [25] "Streptomyces"      ""                  "Mesorhizobium"    
##  [28] "Deefgea"           "Deefgea"           "Yersinia"         
##  [31] "Arthrobacter"      "Marmoricola"       "Microbacterium"   
##  [34] "Microbacterium"    "Microbacterium"    "Thiomonas"        
##  [37] "Thiomonas"         "Thiomonas"         "Thiomonas"        
##  [40] "Thiomonas"         "Micrococcus"       "Curvibacter"      
##  [43] "Bacillus"          "Agrococcus"        "Agrococcus"       
##  [46] "Curvibacter"       "Dermacoccus"       "Curvibacter"      
##  [49] "Agrococcus"        "Sporosarcina"      "Staphylococcus"   
##  [52] "Arthrobacter"      "Sandaracinobacter" "Hydrogenophaga"   
##  [55] "Micromonospora"    "Bacillus"          "Bacillus"         
##  [58] "Mycobacterium"     "Dyadobacter"       "Paenibacillus"    
##  [61] "Bacillus"          "Bacillus"          "Kytococcus"       
##  [64] "Bacillus"          "Paenibacillus"     "Bacillus"         
##  [67] "Bacilllus"         "Salinicoccus"      "Bacillus"         
##  [70] "Shewanella"        "Bacillus"          "Streptomyces"     
##  [73] "Bacillus"          "Bacillus"          "Cellulophaga"     
##  [76] "Salinococcus"      "Salinicoccus"      "Shewanella"       
##  [79] "Shewanella"        "Cellulophaga"      "Cellulophaga"     
##  [82] "Cellulophaga"      "Cellulophaga"      "Shewanella"       
##  [85] "Shewanella"        "Shewanella"        "Micrococcus"      
##  [88] "Salinicoccus"      "Shewanella"        "Rhodococcus"      
##  [91] "Nocardioides"      "Nocardioides"      "Nocardioides"     
##  [94] "Microbacterium"    "Shewanella"        "Rhodococcus"      
##  [97] "Cellulophaga"      "Shewanella"        "Shewanella"       
## [100] "Shewanella"        "Shewanella"        "Cellulophaga"     
## [103] "Algoriphagus"      "Shewanella"        "Maribacter"       
## [106] "Aquimarina"        "Loktanella"        "Aquimarina"       
## [109] "Shewanella"        "Shewanella"        "Shewanella"       
## [112] "Shewanella"        "Vibrio"            "Rhizobium"        
## [115] ""                  "Serratia"          "Rhizobium"        
## [118] "Shewanella"        ""                  "Rhodococcus"      
## [121] "Bacillus"          "Rathayibacter"     "Bacillus"         
## [124] "Shewanella"        "Bacillus"          "Micrococcus"      
## [127] "Bacillus"          "Paenibacillus"     ""                 
## [130] "Pseudomonas"       "Pseudomonas"       "Rhodococcus"      
## [133] "Micrococcus"       "Pseudomonas"
## [1] 44
## # A tibble: 44 x 2
##             value     n
##             <chr> <int>
##  1     Shewanella    19
##  2       Bacillus    17
##  3    Micrococcus     9
##  4   Cellulophaga     7
##  5 Microbacterium     6
##  6  Paenibacillus     6
##  7                    5
##  8   Arthrobacter     5
##  9      Thiomonas     5
## 10    Rhodococcus     4
## # ... with 34 more rows

Now we need to make a column for colors

PCA with scaling, but no log normaliztion

PCA without scaling, no log normaliztion

PCA with scaling, with log normaliztion

PCA without scaling, with log normalization

Look at PCA results in 3D- PCA without scaling, with log normaliztion

while (!is.null(dev.list())) dev.off()

There are some weird taxonomic assignments in the t-SNE:

options(rgl.useNULL=TRUE)
   plot3d(x=e$Axis1,y=e$Axis2,z=e$Axis3,xlab="", ylab="", zlab="",col=cols2)
        rglwidget()
splt <- split(seq_along(sampleNames), ceiling(seq_along(sampleNames)/20))
for(i in splt){

text3d(x=e$Axis1,y=e$Axis2,z=e$Axis3,text=sampleNames[i],col=cols2[i])
  }
    rglwidget()

I created the color column as named colors (eg “Black”,“Blue”), but plotly needs these to be in HEX

plot_ly(x=e$Axis1,y=e$Axis2,z=e$Axis3,text=sampleNames,type="scatter3d",colors=hexVal)
## No scatter3d mode specifed:
##   Setting the mode to markers
##   Read more about this attribute -> https://plot.ly/r/reference/#scatter-mode

Dendrogram

Let’s look at the dendrogram results to see if this might be real and not just a t-SNE effect…

r<-plot_ly(e, x = ~aa, y = ~bb, z = ~cc, type = ‘scatter3d’, mode = ‘markers’,text=sampleNames,color = cols) chart_link = api_create(r, filename=“basic3”) chart_link